home *** CD-ROM | disk | FTP | other *** search
/ Shocking The Web CD-ROM / SHOCK_CD.ISO / pc / resource / earshot / eardemo.dir / 00405_picture printing script.ls < prev    next >
Encoding:
Text File  |  1996-05-17  |  1.4 KB  |  50 lines

  1. on PrintBitmap theCast
  2.   if the castType of cast theCast <> #bitmap then
  3.     alert("PrintBitmap can only print bitmapped castmembers.")
  4.     exit
  5.   end if
  6.   if the machineType = 256 then
  7.     set XObjFile to "pmatic.dll"
  8.   else
  9.     set XObjFile to "pmatic.xobj"
  10.   end if
  11.   openXLib(XObjFile)
  12.   set printer to PrintOMatic(mnew)
  13.   if not objectp(printer) then
  14.     alert("There is no currently selected printer. Printing features are disabled.")
  15.   else
  16.     set pw to printer(mGetPageWidth)
  17.     set ph to printer(mgetpageheight)
  18.     set w to the width of cast theCast
  19.     set h to the height of cast theCast
  20.     set scaling to min(float(pw) / float(w), float(ph) / float(h))
  21.     if (scaling < 1.0) and (w > h) then
  22.       printer(mSetLandscapeMode, 1)
  23.       set pw to printer(mGetPageWidth)
  24.       set ph to printer(mgetpageheight)
  25.       set scaling to min(float(pw) / float(w), float(ph) / float(h))
  26.     end if
  27.     set scaling to min(scaling, 1.0)
  28.     set w to integer(w * scaling)
  29.     set h to integer(h * scaling)
  30.     set left to (pw - w) / 2
  31.     set top to (ph - h) / 2
  32.     printer(mNewPage)
  33.     printer(mPicture, the picture of cast theCast, left, top, left + w, top + h)
  34.     if printer(mDoJobSetup) = 1 then
  35.       updateStage()
  36.       printer(mPrint)
  37.     end if
  38.     printer(mdispose)
  39.   end if
  40.   closeXLib(XObjFile)
  41. end
  42.  
  43. on min a, b
  44.   if a < b then
  45.     return a
  46.   else
  47.     return b
  48.   end if
  49. end
  50.